/*************************
Diese Software ist ein Beispiel (sample code) und unterliegt der Microsoft Public License. 
Die Verwendung des Codes ist unter den Bedingungen der Microsoft Public License erlaubt.
*************************
This software is sample code and is subject to the Microsoft Public License. 
You may use this code according to the conditions of the Microsoft Public License.
*************************/

using System.Collections.Specialized;
using System.Security.Principal;

namespace Egora.Pvp
{
  /// <summary>
  /// Note to implementers:
  /// Implement bool IsInRole(string role) not considering pvp role parameters. 
  /// Implement IIdentity Identity returning an IPvpIdentity.
  /// </summary>
  public interface IPvpPrincipal : IPrincipal
  {
    //
    // Properties (getter, setter)
    //
    string GvOuId { get; set; }
    string Ou { get; set; }

    //
    // Methods
    //
    
    /// <summary>
    /// Determines if the IPvpPrincipal is in role with given name and given parameters.
    /// If you do not want parameters to be considered, use IsInRole from base interface IPrincipal.
    /// Example: Role is Read(GKZ=12345;GKZ=67890)
    /// IsInRole ("Read") delivers true.
    /// IsInRole ("Read", {"GKZ", "12345"}) delivers true.
    /// IsInRole ("Read", {"FOO", "12345"}) delivers false.
    /// </summary>
    /// <param name="pvpRoleName">The role name.</param>
    /// <param name="roleParameters">The role parameters.</param>
    /// <returns>Returns true, if IPvpPrincipal has a role of given name, that has parameters with given name and value.</returns>
    bool IsInRole(string pvpRoleName, NameValueCollection roleParameters);

    IPvpRole[] GetRoles();
    IPvpRole GetRole(string roleName);
  }
}